package org.langcom.live;

import java.util.Set;

import org.langcom.logic.ILogic;

/*
 * Interface purposed for description and validation of life cycle of any business objects
 * Subclasses must implement it with addition of an available delegate methods for object
 * on it's current live stage
 */
public interface ILiveStage<T> {

	public String getDescription();

	public String getTooltip();

	/*
	 * The stages from which a item can become into this one
	 */
	public Set<ILiveStage> getParents();

	public void addParent(ILiveStage<T> liveStage);
	/*
	 * Stages to which a item can become after this one
	 */
	public Set<ILiveStage> getChildren();
	
	public void addChild(ILiveStage<T> liveStage);

	/*
	 * A previous stage of item
	 */
	public ILiveStage becameFrom();

	/*
	 * The method for throwing examined object to next available stages if this
	 * stage is not current stage of this object @param item the tested object
	 * wich not satisfy requirements of previous stage @param previousStage the
	 * previous stage @return <code>ILiveStage</code> the current stage of
	 * live cycle
	 */
	public ILiveStage testItem(T item, ILiveStage previousStage);

	/*
	 * A logic implementation for checking stage of life cycle
	 */
	public void setLogic(ILogic logic);

	public ILogic getLogic();
}
